<template>
  <div class="main" v-color="'bgkImg'">
    <dz-nav :is-back="true" :back-url="-1">
      <template #center>
        <b v-color><qq>balancePayment</qq></b>
      </template>
    </dz-nav>

    <div class="box-1">
      <div class="box-center">
        <div class="titles">
          <img src="@/assets/images/vip.png" alt="">
        </div>
        <div class="bottom-box">
          <div class="tip">{{ form.sellingPrice }}USDT</div>
        </div>
      </div>
    </div>
    <div class="box-2">
      <p>Error messageError messageError messageError message</p>
      <img v-routers="{path:'/purchasing'}" src="@/assets/images/1Withdrawalrecord.png" alt="">
    </div>
    
    <div class="bottom">
      <dz-button @click="show=true"><qq>Pay</qq></dz-button>
    </div>

    <dz-safe></dz-safe>

    <van-popup
        closeable
        :overlay="false"
        v-model="show"
        position="bottom"
        :style="{  minHeight: '85%' }"
        round>
      <div class="box-3">
        <img  src="@/assets/images/pwd.png" alt="">
        <p class="title"><qq>Pleaseenterthetransactionpassword</qq></p>
        <div class="input-bottom">
          <van-password-input
              :value="value"
              :length="6"
              :focused="showKeyboard"
              @focus="showKeyboard = true"
          />
          <!-- 数字键盘 -->
          <van-number-keyboard
              v-model="value"
              :show="showKeyboard"
              @blur="showKeyboard = false"
          />
        </div>
        <div class="submit">
          <dz-button @click="toRecharge"><qq>submit</qq></dz-button>
        </div>
      </div>
    </van-popup>
  </div>
</template>

<script>
import {getBalance, payChannel} from "@/api/apiFox";
import {Toast} from "vant";


export default {
  data(){
    return{
      list:[],
      payments:[],
      form:{sellingPrice:0},
      payMethod:[],
      show:false,
      value: '',
      showKeyboard: true,
    }
  },
  methods:{
    getPayChannels() {
      payChannel().then(res => {
        this.payMethod = res.data
      }).catch(err => {})
    },
    getList(money){
      this.form.sellingPrice=money
    },

    toRecharge(item){
      console.log(this.value)
      if (!this.value && this.value.length<6){
        Toast.fail(this.$t('Pleaseenteryourpasswordfirst'))
      }else{
        getBalance().then(res=>{
          console.log(res)
          if (this.form.sellingPrice<res){
            console.log('钱够了')
          }else{
            this.$router.push('/recharge').catch(err=>{})
          }
        }).catch(err=>{})
      }

    },

  },
  mounted() {
    this.getPayChannels()
    this.getList(this.$route.query.money)
  }
  }
</script>

<style scoped lang="scss">
.main{
  width: 100%;
  min-height: 100vh;
  .right-nav{
    width: 90px;
    height: 35px;
    background: #FFFFFF;
    border-radius: 20px 20px 20px 20px;
    border: 1px solid #E08821;
    box-sizing: border-box;
    margin-left: -15px;
    margin-top: 3px;
    z-index: 99;
    position: absolute;
    font-weight: 500;
    font-size: 12px;
    color: #E08821;
    display: flex;
    justify-content: center;
    align-items: center;
    img{
      width: 28px;
      height: 28px;
    }
  }
  .box-1{
    width: 100%;
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    .box-center{
      width: 331px;
      background: url('@/assets/images/CARD_1.png') no-repeat;
      background-size: 100%;
      height: 148px;
      border-radius: 10px;
      position: relative;
      .titles{
        width: 100%;
        text-align: center;
        margin-top: -30px;
        img{
          width: 122px;
          height: 123px;
          object-fit: cover;
        }
      }
      .bottom-box{
        width: 100%;
        height: 40px;
        display: flex;
        justify-content: center;
        align-items: center;
        .tip{
          width: 185px;
          height: 47px;
          background: rgba(255,184,41,0.37);
          border-radius: 30px 30px 30px 30px;
          font-weight: bold;
          font-size: 28px;
          color: #533DF1;
          display: flex;
          justify-content: center;
          align-items: center;
        }
      }
    }
    .box-center-1{
      width: 324px;
      height: 253px;
      background: #FFFFFF;
      border-radius: 10px;
      .top{
        width: 324px;
        height: 40px;
        background: #FFFFFF;
        border-radius: 10px 10px 0px 0px;
        font-weight: bold;
        font-size: 20px;
        color: #000000;
        text-align: center;
        line-height: 40px;
      }
      .vip-info{
        width: 324px;
        height: 213px;
        background: #F2F2F2;
        border-radius: 0px 0px 10px 10px;
        padding: 22px 15px;
        box-sizing: border-box;
        .box-nav{
          width: 100%;
          height: 42px;
          display: flex;
          justify-content: space-between;
          margin-bottom: 18px;
          img{
            object-fit: cover;
            width: 42px;
            height: 42px;
            margin-right: 10px;
          }
          .right{
            width: 100%;
            .title{
              font-weight: bold;
              font-size: 14px;
              color: #666666;
            }
            .content{
              font-weight: bold;
              font-size: 14px;
              margin-top: 6px;
              color: #373737;
            }
          }
        }
      }
    }
  }
  .box-2{
    margin-top: 10px;
    text-align: right;
    width: 100%;
    padding: 0 16px;
    box-sizing: border-box;
    p{
      font-weight: 400;
      font-size: 12px;
      text-align: center;
      color: #FF402F;
    }
    img{
      height: 70px;
      width: 70px;
      object-fit: cover;
      margin-top: 10px;
    }
  }
  .bottom{
    width: 100%;
    height: 100px;
    padding: 0 16px;
    box-sizing: border-box;
    position: absolute;
    bottom: 0;
    left: 0;
  }
  .box-3{
    width: 100%;
    padding:20px 28px;
    box-sizing: border-box;
    text-align: center;
    img{
      width: 97px;
      height: 131px;
      object-fit: cover;
    }
    .title{
      width: 100%;
      text-align: center;
      font-weight: bold;
      font-size: 16px;
      color: #533DF1;
    }
    .input-bottom{
      width: 100%;
      height: 50px;
      margin-top: 20px;
      .item{
        width: 50px;
        height: 50px;
        background: #FFFFFF;
        border-radius: 4px 4px 4px 4px;
        border: 1px solid #A5AAB7;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
      }
    }
    .submit{
      width: 100%;
      margin-top: 20px;
    }
  }
  ::v-deep(.van-popup){
    background: linear-gradient( 180deg, #FFF0C9 0%, #D49188 100%);
    box-shadow: inset 0px 4px 4px 0px rgba(255,255,255,0.25);
  }
  ::v-deep(.van-password-input__security li){
    width: 50px;
    height: 50px;
    background: #FFFFFF;
    border-radius: 4px 4px 4px 4px;
    border: 1px solid #A5AAB7;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin-right: 5px;
  }
  ::v-deep([class*=van-hairline]:after){
    border: none;
  }
  ::v-deep(.van-password-input){
    margin: 0;
  }
}
</style>